package cn.wolfcode.p2p.base.util;

import cn.wolfcode.p2p.base.exception.DisplayableException;

//断言工具类
public class AsserUtil {

    /**
     * 判断非空
     * @param obj 前台传进来需要判断非空的字段
     * @param msg 如果为空 则显示在前台的信息
     */
    public static void isNotNull(Object obj, String msg){
        if(obj == null || "".trim().equals(obj)){
            throw new DisplayableException(msg);
        }
    }

    /**
     * 判断密码和确认密码是否一致
     * @param password      密码
     * @param confirmPwd    确认密码
     */
    public static void isEqual(String password, String confirmPwd,String msg){
        if(!password.equals(confirmPwd)){
            throw new DisplayableException(msg);
        }
    }
}
